﻿using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;

namespace Deferred.Library.Scene
{
    /// <summary>
    /// 
    /// </summary>
    public class DrawableObject
    {
        [ContentSerializer(Optional = true)]
        private string modelName;

        /// <summary>
        /// 
        /// </summary>
        public event EventHandler OnModelNameChanged;

        /// <summary>
        /// 
        /// </summary>
        [ContentSerializer(Optional = true)]
        public Vector3 Position { get; set; }
        /// <summary>
        /// 
        /// </summary>
        [ContentSerializer(Optional = true)]
        public Quaternion Rotation { get; set; }
        /// <summary>
        /// 
        /// </summary>
        [ContentSerializer(Optional = true)]
        public Vector3 Scale { get; set; }
        /// <summary>
        /// 
        /// </summary>
        [ContentSerializerIgnore]
        public string ModelName
        {
            get { return modelName; }
            set
            {
                modelName = value;
                if (OnModelNameChanged != null) OnModelNameChanged(this, EventArgs.Empty);
            }
        }

        /// <summary>
        /// 
        /// </summary>
        public DrawableObject()
            : this("") { }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="modelName"></param>
        /// <param name="Rotation"></param>
        /// <param name="Scale"></param>
        public DrawableObject(string modelName, Quaternion Rotation, Vector3 Scale)
            : this(modelName, Vector3.Zero, Rotation, Scale) { }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="modelName"></param>
        public DrawableObject(string modelName)
            : this(modelName, Vector3.Zero, Quaternion.Identity, Vector3.One) { }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="modelName"></param>
        /// <param name="Position"></param>
        /// <param name="Scale"></param>
        public DrawableObject(string modelName, Vector3 Position, Vector3 Scale)
            : this(modelName, Position, Quaternion.Identity, Scale) { }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="modelName"></param>
        /// <param name="Position"></param>
        public DrawableObject(string modelName, Vector3 Position)
            : this(modelName, Position, Quaternion.Identity) { }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="modelName"></param>
        /// <param name="Position"></param>
        /// <param name="Rotation"></param>
        public DrawableObject(string modelName, Vector3 Position, Quaternion Rotation)
            : this(modelName, Position, Rotation, Vector3.One) { }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="modelName"></param>
        /// <param name="Position"></param>
        /// <param name="Rotation"></param>
        /// <param name="Scale"></param>
        public DrawableObject(string modelName, Vector3 Position, Quaternion Rotation, Vector3 Scale)
        {
            this.ModelName = modelName;
            this.Position = Position;
            this.Rotation = Rotation;
            this.Scale = Scale;
        }

        
    }
}
